package com.yugao.fintech.draper.admin.controller;

import com.yugao.fintech.draper.admin.service.SocialAppService;
import com.yugao.fintech.draper.core.model.ResultVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 第三方平台相关信息
 */
@RequiredArgsConstructor
@RequestMapping("/third")
@RestController
public class SocialAppController {
	private final SocialAppService socialAppService;

	/**
	 * 获取第三方平台的绑定信息
	 * @return 第三方平台的绑定信息
	 */
	@GetMapping("/bindSocialApp")
	public ResultVO<?> bindSocialApp() {
		return ResultVO.success(socialAppService.bindSocialApp());
	}

	/**
	 * 解除绑定
	 * @param type 平台类型
	 */
	@PutMapping("/unbind")
	public ResultVO<Void> unbind(String type) {
		socialAppService.unBind(type);
		return ResultVO.success();
	}
}
